﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using AKJ.Sharepoint.Branding.Config;

namespace AKJ.Sharepoint.Branding
{  
    /*    
     <VisualBranding>
        <ApplyMaster master="mymaster.master" path="settings.aspx" />
        <ApplyMaster master="mymaster.master" path="/Layouts/" />      
        <Redirect from="/_layouts/settings.aspx" to="/_layouts/settings.aspx" />     
     </VisualBranding>     
     */

    //Second we need to create the custom ConfigurationSection    
    public class VisualBrandingSection : ConfigurationSection
    {
        [ConfigurationProperty("RebrandPaths", IsDefaultCollection = true),
        ConfigurationCollection(typeof(RebrandPathCollection), AddItemName = "RebrandPath")]
        public RebrandPathCollection RebrandPaths
        {
            get { return this["RebrandPaths"] as RebrandPathCollection; }
        }

        [ConfigurationProperty("QuerystringBrandings", IsDefaultCollection = false),
        ConfigurationCollection(typeof(QuerystringBrandingCollection), AddItemName = "QuerystringBranding")]
        public QuerystringBrandingCollection QuerystringBrandings
        {
            get { return this["QuerystringBrandings"] as QuerystringBrandingCollection; }
        }

        [ConfigurationProperty("BrandingInterceptors", IsDefaultCollection = false),
        ConfigurationCollection(typeof(BrandingInterceptorCollection), AddItemName = "Interceptor")]
        public BrandingInterceptorCollection BrandingInterceptors
        {
            get { return this["BrandingInterceptors"] as BrandingInterceptorCollection; }
        }

        public static VisualBrandingSection Instance()
        {
            VisualBrandingSection instance = ConfigurationManager.GetSection("VisualBranding") as VisualBrandingSection;
            return instance;
        }
                        
    }    
}
